Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
Hexagons
Watch on
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } @import url("https://fonts.googleapis.com/css?family=Montserrat:400,700"); * { margin: 0; padding: 0; box-sizing: border-box; } body { background-color: #131217; width: 100%; height: 100vh; position: relative; display: grid; place-content: center; font-family: Montserrat; overflow: hidden; } h1 { font-size: 8rem; font-weight: 700; color: white; position: relative; z-index: 2; text-align: center; } #pattern { position: absolute; top: -44px; left: -50px; right: 0; bottom: 0; } #gradient { background: radial-gradient(#ff8811, transparent 50%); width: 400px; height: 400px; position: absolute; top: -200px; left: -200px; transform: translate(200px, 200px); } /* -- youtube link styling -- */ .links { border-top: 1px solid #ffffff50; border-right: 1px solid #ffffff50; border-top-right-radius: 0.5rem; position: fixed; bottom: 0; left: 0; padding: 0.5rem; font-family: Montserrat; font-size: 1.2rem; font-weight: 400; display: flex; flex-direction: column; gap: 0.5rem; & > a { color: #ffffff; text-decoration: none; display: flex; justify-content: space-between; align-items: center; opacity: 0.5; &:hover { opacity: 1; } & > svg { margin-left: 0.5rem; flex-shrink: 0; } &:nth-child(1) > svg { stroke: #dd2d4a; } &:nth-child(2) > svg { stroke: #2b59c3; } } }
console.log("Event Fired") const patternElement = document.getElementById("pattern"); const countY = Math.ceil(patternElement.clientHeight / 40) + 1; const countX = Math.ceil(patternElement.clientWidth / 48) + 1; const gap = 2; for (let i = 0; i < countY; i++) { for (let j = 0; j < countX; j++) { const hexagon = document.createElement("div"); hexagon.style = ` background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODciIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgODcgMTAwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMi4xOTg3MyAyNi4xNTQ3TDQzLjUgMi4zMDk0TDg0LjgwMTMgMjYuMTU0N1Y3My44NDUzTDQzLjUgOTcuNjkwNkwyLjE5ODczIDczLjg0NTNWMjYuMTU0N1oiIGZpbGw9IiMxMzEyMTciIHN0cm9rZT0iIzEzMTIxNyIgc3Ryb2tlLXdpZHRoPSI0Ii8+Cjwvc3ZnPgo=') no-repeat; width: 44px; height: 50px; background-size: contain; position: absolute; top: ${i * 40}px; left: ${j * 48 + ((i * 24) % 48)}px; `; patternElement.appendChild(hexagon); } } let mousePosition = { x: 0, y: 0 }; document.addEventListener("mousemove", (mouse) => { mousePosition = { x: mouse.clientX, y: mouse.clientY }; }); const loop = () => { const gradientElement = document.getElementById("gradient"); gradientElement.style.transform = `translate(${mousePosition.x}px, ${mousePosition.y}px)`; // Request the next animation frame window.requestAnimationFrame(loop); }; // Start the animation loop window.requestAnimationFrame(loop);